#pragma once

#include <iostream>
#include <string>
#include <functional>
#include "log.hpp"

typedef std::function<void(int,const std::string &, const uint16_t &,const std::string &)> func__t;

class Task
{
public:
    Task(){}
    Task(int sock,std::string ip,uint16_t port, func__t func):_sock(sock),_ip(ip),_port(port),_func(func)
    {}
    void operator ()(const std::string &name)
    {
        //std::cout << "线程 " << name << " 处理完成, 结果是: " << x_ << "+" << y_ << "=" << func_(x_, y_) << std::endl;
        // logMessage(WARNING, "%s处理完成: %d+%d=%d | %s | %d",
        //     name.c_str(), x_, y_, func_(x_, y_), __FILE__, __LINE__);
        _func(_sock,_ip,_port,name);
    }
public:
    int _sock;
    std::string _ip;
    uint16_t _port;
    
    func__t _func;
};